package com.tao.context;


import javax.servlet.ServletContext;

import org.springframework.web.context.WebApplicationContext;


public abstract class ApplicationContextUtil {
	private static WebApplicationContext context;
	private static ServletContext servletContext;

	public static void setWebApplicationContext(WebApplicationContext context){
		ApplicationContextUtil.context = context;
	}
	
	public static WebApplicationContext getWebApplicationContext(){
		return context;
	}
	
	public static void setApplication(ServletContext servletContext){
		ApplicationContextUtil.servletContext = servletContext;
	}
	
	public static ServletContext getApplication(){
		return servletContext;
	}
	
	public static String getProperty(String key){
		Object v = servletContext.getAttribute(key);
		return v instanceof String?(String)v:null;
	}
}
